<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title><?=$this->config->item('site_title');?></title>
<link rel="stylesheet" type="text/css" href="<?= base_url() . 'resource/jeasyui/themes/metro/easyui.css' ?>"/>
<link rel="stylesheet" type="text/css" href="<?= base_url() . 'resource/jeasyui/themes/icon.css' ?>"/>
<link rel="stylesheet" type="text/css" href="<?= base_url() . 'resource/css/bootstrap.css' ?>?20170717"/>
<link rel="stylesheet" type="text/css" href="<?= base_url() . 'resource/css/font-awesome.min.css' ?>?20170717"/>
<link rel="stylesheet" type="text/css" href="<?=base_url().'resource/css/css.css'?>" />
<script type="text/javascript" src="<?=base_url().'resource/js/jquery.min.js'?>" ></script>
<script type="text/javascript" src="<?=base_url().'resource/js/common.js'?>" charset="utf-8"></script>
<script>
function member_submit() {
    //用户名
    if(!isempty('account','<?=lang('member_yhmbnwk')?>'))return false;
    //密码验证
    if(!isempty('password','<?=lang('member_mmbnwk')?>'))return false;
    if(!isempty('password2','<?=lang('member_qrmmbnwk')?>'))return false;
    if($("input[name=password]").val() != $("input[name=password2]").val()){
        alert('<?=lang('member_srdmmbyz')?>');
        return false;
    }
    //真实姓名
    if(!isempty('userName','<?=lang('member_zsxmbnwk')?>'))return false;
	//邮箱验证
	if(!isempty('email','<?=lang('member_yxbnwk')?>'))return false;
	var email = $("input[name=email]").val();
	var reg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
	if (!reg.test(email)) {
        alert('<?=lang('member_yxgsbzq')?>');
        $("input[name=email]").focus();
        return false;
    }
    //职位
    if(!isempty('position','<?=lang('member_zwbnwk')?>'))return false;
	//角色验证
	if($("#roleId").val() == 0){
		alert('<?=lang('member_qxzndjs')?>');
		return false;
	}
	return true;
}

$(function(){
    $("input[name=account]").blur(function(){
        var account = $(this).val();
        if($.trim(account)=='')return;
        $.get("<?=blang_url('home/valid_account')?>",{account:account}, function(status){
           if(status == 0){
               $("#accountTips").text('<?=lang('member_kyzc')?>').css("color","#24A06B");
           }else{
               $("input[name=account]").val('').focus();
               $("#accountTips").text('('+account+') <?=lang('member_ybzc')?>').css("color","red");;
           }
        });
    });
})
</script>
</head>
<body>
<div id="container">
  <header id="header" class="navbar navbar-static-top" style="height:45px;">
  <div class="navbar-header">
    <a href="<?= base_url()?>" class="navbar-brand" style="padding:10px;"><img src="<?=base_url().'resource/images/index.jpg'?>" alt="tomrepair oms" title="tomrepair oms"></a></div>
    <ul class="nav pull-right">
    <li>
        <select class="form-control language" onchange="if(this.value!='')location.href=this.value">
            <option value="" >Select Language...</option>
            <option value="<?=base_url(anewlang('english'))?>" <?=$optlang['english']?> >English</option>
            <option value="<?=base_url(anewlang('sc'))?>" <?=$optlang['sc']?> >简体中文</option>
            <option value="<?=base_url(anewlang('es'))?>" <?=$optlang['es']?> >Español</option>
        </select>
    </li>
  </ul>
</header>
<div id="content">
  <div class="container-fluid"><br><br><br><br>
    <div class="row">
      <div class="col-sm-offset-4 col-sm-4">
        <div class="panel panel-default">
          <div class="panel-heading">
            <h1 class="panel-title"><i class="fa fa-user"></i>&nbsp;<?=lang('member_zhuce')?></h1>
          </div>
          <div class="panel-body" style="border: none;">
            <form action="<?=blang_url('home/'.$post_type)?>" method="post" name="memberform" onsubmit="return member_submit()" autocomplete="off" >
              <div class="form-group">
                <label for="input-username"><span class="red">*</span><?=lang('member_yhm')?></label>
                <div class="input-group"><span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                  <input type="text" class="form-control" name="account" value="<?=$userFirst['account']?>" />
                </div>
                <span id="accountTips"></span>
              </div>
              <div class="form-group">
                <label for="input-username"><span class="red">*</span><?=lang('member_mima')?></label>
                <div class="input-group"><span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                  <input type="password" class="form-control" name="password" />
                </div>
              </div>
              <div class="form-group">
                <label for="input-username"><span class="red">*</span><?=lang('member_zsxm')?></label>
                <div class="input-group"><span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                  <input type="text" class="form-control" name="userName" value="<?=$userFirst['name']?>" />
                </div>
              </div>
              <div class="form-group">
                <label for="input-username"><span class="red">*</span><?=lang('member_youxiang')?></label>
                <div class="input-group"><span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                  <input type="text" class="form-control" name="email" value="<?=$userFirst['email']?>" />
                </div>
              </div>
              <div class="form-group">
                <label for="input-username"><span class="red">*</span><?=lang('member_zhiwei')?></label>
                <div class="input-group"><span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                  <input type="text" class="form-control" name="position" value="<?=$userFirst['position']?>" />
                </div>
              </div>
              <div class="form-group">
                <label for="input-username"><span class="red">*</span><?=lang('member_jiaose')?></label>
                <div class="input-group"><span class="input-group-addon"><i class="fa fa-pencil"></i></span>
                  <select class="form-control" name="role" id="roleId">
                      <option value="0" >--<?=lang('public_qxz')?>--</option>
                      <?php foreach ($roleList as $row):?>
                        <option value="<?=$row['id'].'_'.$row['name_en']?>"><?=$row['name']?></option>
                      <?php endforeach;?>
                  </select>
                </div>
              </div>
              <div class="text-right">
                <a class="btn btn-oms" href="<?=blang_url()?>"><i class="fa fa-location-arrow"></i>&nbsp;<?=lang('member_qdl')?></a>
                <input type="submit" value="<?=lang('member_zhuce')?>" class="btn btn-primary" name="submits"/>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>